{extend name="public/base" /}
{block name='content'}
{include file='public/content_header' /}
<!--数据列表页面-->
<section class="content">

    <!--顶部搜索筛选-->
    <div class="row">
        <div class="col-md-12">
            <div class="box">
                <div class="box-body">
                    <form class="form-inline searchForm" id="searchForm" action="{:url('index')}" method="GET">

                        <div class="form-group">
                            <select name="staff_id" id="staff_id" class="form-control field-select"
                                    data-placeholder="请选择员工">
                                <option value="">请选择员工</option>
                                {foreach name='staff_list' id='item'}
                                <option value="{$item.id}" {if isset($staff_id) && $staff_id==$item.id}selected{/if}>
                                    {$item.name}
                                </option>
                                {/foreach}
                            </select>
                        </div>
                        <script>
                            $('#staff_id').select2();
                        </script>
                        <div class="form-group" >
                            <div class="col-md-2">
                                <input id="salary_time" name="salary_time"
                                       value="{if isset($salary_time)}{$salary_time}{else}{/if}" placeholder="请工资时间" type="text" class="form-control filed-datetime" autocomplete="off">
                            </div>
                        </div>
                        <script>
                            $('#staff_id').select2();
                            $('#department_id').select2();
                            var currentTime ='';
                            if ($('#salary_time').val()){
                                currentTime = $('#salary_time').val();
                            }

                            laydate.render({
                                elem: '#salary_time',
                                type: 'month',
                                btns:[],
                                ready: function (date) {
                                    $(".layui-laydate").on('click', 'ul li', function () {
                                        $(".layui-laydate").remove();
                                    });
                                },
                                change: function (value) {
                                    $("#salary_time").val(value);
                                },
                                value:currentTime,
                            });
                        </script>
                        <div class="form-group">
                            <select name="_order" id="_order" class="form-control input-sm index-order">
                                <option value="">排序字段</option>
                                <option value="staff_id" {if isset($_order) && $_order=='staff_id'}selected{/if}>
                                    用户
                                </option>
                                <option value="status" {if isset($_order) && $_order=='status'}selected{/if}>
                                    发送状态
                                </option>
                                <option value="update_time" {if isset($_order) && $_order=='update_time'}selected{/if}>
                                    发送时间
                                </option>
                            </select>
                        </div>
                        <div class="form-group">
                            <select name="_by" id="_by" class="form-control input-sm index-order">
                                <option value="">排序方式</option>
                                <option value="asc" {if isset($_by) && $_by=='asc'}selected{/if}>正序</option>
                                <option value="desc" {if isset($_by) && $_by=='desc'}selected{/if}>倒序</option>
                            </select>
                        </div>


                        <div class="form-group">
                            <button class="btn btn-sm btn-primary" type="submit"><i class="fa fa-search"></i> 查询
                            </button>
                        </div>

                        <div class="form-group">
                            <button onclick="clearSearchForm()" class="btn btn-sm btn-default" type="button"><i
                                    class="fa  fa-eraser"></i> 清空查询
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <div class="box">

                <!--数据列表顶部-->
                <div class="box-header">
                    <div>
                        <a class="btn btn-danger btn-sm AjaxButton" data-toggle="tooltip" title="删除选中数据"
                           data-confirm-title="删除确认" data-confirm-content="您确定要删除选中的数据吗？" data-id="checked"
                           data-url="{:url('del')}">
                            <i class="fa fa-trash"></i> 删除
                        </a>

                        <a class="btn btn-success btn-sm ReloadButton" data-toggle="tooltip" title="刷新">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-hover table-striped table-bordered table-condensed datatable" id="table" data-toggle="table" >
                        <thead>
                        <tr>
                            <th>
                                <input id="dataCheckAll" type="checkbox" onclick="checkAll(this)" class="checkbox"
                                       placeholder="全选/取消">
                            </th>

                            <th>姓名</th>
                            <th>薪资时间</th>
                            <th>发送提示</th>
                            <th>发送信息</th>
                            <th>发送状态</th>
                            <th>创建时间</th>
                            <th>发件人</th>
                            <th>邮件地址</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name="data" item="item"}
                        <tr>
                            <td>
                                <input type="checkbox" onclick="checkThis(this)" name="data-checkbox"
                                       data-id="{$item.id}" class="checkbox data-list-check" value="{$item.id}"
                                       placeholder="选择/取消">
                            </td>
                            <td><p style="white-space: nowrap; text-overflow: ellipsis;">{$item.staff_name}</p></td>
                            <td>{if $item.salary_time}{$item.salary_time |date="Y-m"}{else}暂无{/if}</td>
                            <td><p style="white-space: normal; text-overflow: ellipsis;">
                                {$item.salary_email_msg}</p></td>
                            <td>{$item.salary_email_content}</td>
                            <td>{$item.status_text}</td>
                            <td><p style="white-space: nowrap; text-overflow: ellipsis;">{$item.update_time|date='Y-m-d h:i:s'}</p></td>
                            <td>{$item.sender}</td>
                            <td>{$item.address}</td>
                            <td class="td-do">
                                <a class="btn btn-danger btn-xs AjaxButton" data-toggle="tooltip" title="删除"
                                   data-id="{$item.id}" data-confirm-title="删除确认"
                                   data-confirm-content='您确定要删除ID为 <span class="text-red">{$item.id}</span> 的数据吗'
                                   data-url="{:url('del')}">
                                    <i class="fa fa-trash"></i>
                                </a>

                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </div>

                <!-- 数据列表底部 -->
                <div class="box-footer">
                    {$page|raw}
                    <label class="control-label pull-right" style="margin-right: 10px; font-weight: 100;">
                        <small>共{$total}条记录</small>&nbsp;
                        <small>每页显示</small>
                        &nbsp;
                        <select class="input-sm" onchange="changePerPage(this)">
                            <option value="10" {if $admin.per_page==10}selected{/if}>10</option>
                            <option value="20" {if $admin.per_page==20}selected{/if}>20</option>
                            <option value="30" {if $admin.per_page==30}selected{/if}>30</option>
                            <option value="50" {if $admin.per_page==50}selected{/if}>50</option>
                            <option value="100" {if $admin.per_page==100}selected{/if}>100</option>
                        </select>
                        &nbsp;
                        <small>条记录</small>
                    </label>
                </div>

            </div>
        </div>
    </div>
</section>
<script>
    $(function () {
        $(window).resize(function() {
            $('#table').bootstrapTable('destroy').bootstrapTable(
                {
                    height:$(window).height()-306,
                });
        });
        $('.table').bootstrapTable('destroy').bootstrapTable(
            {height:$(window).height()-306,
            fixedColumns:true,
            fixedNumber:3,
            onClickRow:function (row,$element) {
                $('.info').removeClass('info');//移除class
                $($element).addClass('info');//添加class
            },
        });
    });
</script>
{/block}

